package cn.elwy.rcp.ui.explorer;

import java.util.List;

import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.swt.events.SelectionEvent;

import cn.elwy.rcp.ui.explorer.core.vo.BuilderModule;
import cn.elwy.rcp.ui.table.listener.TablePaneButtonListener;

public class SelectionAllListener extends TablePaneButtonListener {

	private boolean selectAll;

	public SelectionAllListener() {
	}

	@Override
	@SuppressWarnings("unchecked")
	public void widgetSelected(SelectionEvent e) {
		ColumnViewer tableViewer = tablePane.getTableViewer();
		List<BuilderModule> input = (List<BuilderModule>) tableViewer.getInput();
		for (BuilderModule builderModule : input) {
			builderModule.setBuilder(!selectAll);
		}
		selectAll = !selectAll;
		tableViewer.refresh();
		super.widgetSelected(e);
	}
}
